<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
    <div id="app">
        <textarea cols="30" rows="10" v-model="comment"></textarea>
        <button @click="add">发布评论</button>

        <table>
            <tr>
                <th>用户名</th>
                <th>评论内容</th>
                <th>点赞数</th>
                <th>发布时间</th>
                <th>操作</th>

            </tr>
            <tr v-for="(item,index) in list">
                <td>{{item.name}}</td>
                <td>{{item.comment}}</td>
                <td>{{item.like}}</td>
                <td>{{new Date(item.time).toLocaleDateString().replace(/\//g, "-")}}</td>
                <td>
                    <button @click="item.like++">点赞</button>
                    <button @click="top(item,index)">置顶</button>
                    <button @click="del(item,index)">删除</button>
                </td>
            </tr>

        </table>
    </div>

</body>

</html>